<meta charset="utf-8">
窗前明月光，疑是地上霜
<script>
    var s = "窗前明月光，疑是地上霜";
    document.write("窗前明月光，疑是地上霜<br/>共有"+s.length+"个字，");
    document.write("光的位置是第"+s.indexOf("光")+"个<br/>");
    document.write(s.substring(2,4));
</script>